package com.zl.roomdesign.main

import com.zl.core.api.data.BaseResult
import io.reactivex.Observable
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.http.*


/**
 * Created by zhangli on 2018/5/6,19:13<br/>
 */
interface MainApi {

    @POST("design/material")
    fun getMaterial(): Observable<BaseResult<MutableList<MaterialEntity>>>

    @POST("design/insertAll")
    fun refresh(): Observable<BaseResult<MutableList<MaterialEntity>>>

    @POST("getAll")
    fun getAll(): Observable<BaseResult<MutableList<ImageEntity>>>

    @POST("getByUser")
    fun getByUser(@Query("phone") phone: Long): Observable<BaseResult<MutableList<ImageEntity>>>

    @Streaming
    @Multipart
    @POST("upload")
    fun upload(@Part file: MultipartBody.Part, @QueryMap map: Map<String, String>): Observable<BaseResult<ImageEntity?>>

    @Streaming
    @Multipart
    @POST("design/uploadMulti")
    fun uploadMultiMaterial(@PartMap files: Map<String, @JvmSuppressWildcards RequestBody>, @QueryMap map: Map<String, String>): Observable<BaseResult<String?>>

    @POST("delete")
    fun delete(@Query("id") id: String): Observable<BaseResult<Any?>>
}